/********************************************/
  // Creation History
  // --------------------------------------------------------------
  //	Company:			HTHK
  //	NAME:				JobSearch.java
  //    Title   :			find if Restirct Records, return one or more records
  //	FUNCTION:
  //	BY:					Jet Tao
  //	DATE:				16/12/2003
  // --------------------------------------------------------------
/*********************************************/

package tss.restrict;

import javax.servlet.*;
import javax.servlet.http.*;

import java.io.*;
import java.sql.*;

import com.ffpc.sql.*;
import com.ffpc.struts.StrutsMessage;

import tss.common.DBServlet2;

/**
 * A Class class.
 * <P>
 * @author HTHK
 */
public class RestrictSearch
  extends DBServlet2 {

  @Override
protected String perform(  HttpServletRequest request,
                             HttpServletResponse response,
                             StrutsMessage message)
    throws  ServletException,
            IOException,
            SQLException,
            DataException,
            Exception
  {
              RestrictBean restrictbean = RestrictProcess.createBean();
        String s = "";
        s = request.getParameter("restrict_unit");
        restrictbean.setUnit(request.getParameter("restrict_unit"));
        if(s != null && s.length() != 0)
            message.setMessage("Save successfully.");
        RestrictBean arestrictbean[] = RestrictProcess.find(getConnection(), restrictbean);
        if(arestrictbean == null || arestrictbean.length == 0)
        {
            message.setMessage("No record, please input another criteria.");
            return "tss/restrict/RestrictSearch.jsp";
        } else
        {
            request.setAttribute("Restrict", arestrictbean[0]);
            return "tss/restrict/Restrict.jsp?formAction=Update";
        }

  }
}


